//spu
import request from '@/utils/request'
import type { SpuList,SpuData } from './type'
enum API {
  SPU_URL = '/admin/product',
  //添加
  ADDSPU_URL = '/admin/product/saveSpuInfo',
//   修改
  UPDATESPU_URL = '/admin/product/updateSpuInfo',
  //删除
  DELETESPU_URL = '/admin/product/deleteSpu',
//   详情
  DETAILSPU_URL = '/admin/product/getSpuInfo',
}
export const reqHasSpu = (
  page: number,
  limit: number ,
) =>
  request.get<any, SpuList>(
    API.SPU_URL +
      `/${page}/${limit}`,
  )

export const reqUpdateSpu = (data: SpuData) =>
  request.delete<any, any>(API.UPDATESPU_URL + data)

export const reqAddSpu = (data: SpuData) => {
  //新增
  return request.post<any, any>(API.ADDSPU_URL, data)
}

//删除
export const reqDeleteSpu = (spuId: number) =>
  request.delete<any, any>(API.DELETESPU_URL + spuId)

  export const reqDetailSpu = (spuId: number) =>
  request.delete<any, any>(API.DETAILSPU_URL + spuId)

